import { defineStore } from "pinia";
export const musicStore = defineStore("musicData", {
  state: () => ({
    //当前播放歌曲id
    songId: "",
    //当前播放歌单列表
    songListIds: [],
    //当前播放模式
    playOrder: 0,
    //当前播放歌曲信息
    musicDetail: {},
    //当前播放状态
    isPlaying: false,
    //播放时间
    currentTime: 0,
    //用户喜欢歌曲id列表
    likeIdList: [],
    //音乐品质
    soundQuality: "standard",
  }),
  actions: {
    setCurrentTime(data) {
      this.currentTime = data;
    },
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: "current",
        storage: localStorage,
        paths: [
          "songId",
          "songListIds",
          "playOrder",
          "isPlaying",
          "currentTime",
          "likeIdList",
          "soundQuality",
        ],
      },
    ],
  },
  getters: {},
});
